#include <iostream>
#include "pine.h"
#include <unistd.h>

int count = 0;
std::mutex g_mutex;
static Logger::ptr g_logger = MYWEB_LOG_ROOT();

void add_count(int &a, int n) {
    std::unique_lock<std::mutex> lock(g_mutex);
    MYWEB_LOG_INFO(g_logger) << "run\n";
    for(int i=0;i<n;i++) {
        a++;
    }
}

int main(){
    ThreadPool tp(5);

    tp.Add(add_count, std::ref(count), 100);
    tp.Add(add_count, std::ref(count), 100);
    tp.Add(add_count, std::ref(count), 100);

    sleep(1);
    std::cout << count << std::endl;
}
